package com.itboye.sunsun.forum.ui;

import java.util.ArrayList;
import java.util.List;

import com.itboye.sunsun.R;
import com.itboye.sunsun.Application.App;
import com.itboye.sunsun.adapter.MyPostAdaper;
import com.itboye.sunsun.adapter.OrderListViewAdapter;
import com.itboye.sunsun.beans.OrderBean;
import com.itboye.sunsun.custome.XListView;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

@SuppressLint("ValidFragment")
public class HPostFragment extends Fragment {

	private Context context;

	private View allView;
	private XListView xListView;
	private MyPostAdaper orderAdapter;

	public HPostFragment() {

	}

	public HPostFragment(Context context) {
		this.context = context;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		allView = inflater.inflate(R.layout.fragment_allfragment, container,false);

		initView();
		return allView;
	}

	public void initView() {
		xListView = (XListView) allView.findViewById(R.id.xlistview);

		List list = new ArrayList();
		list.add("hha");
		list.add("11");

		orderAdapter = new MyPostAdaper(App.ctx, getData());

		xListView.setAdapter(orderAdapter);

	}
	
	public List<OrderBean> getData()
	{
		List<OrderBean> msgList = new ArrayList<OrderBean>();
		OrderBean orderBean;
		orderBean = new OrderBean();
		orderBean.setType(1);
		orderBean.setValue("100");
		msgList.add(orderBean);
		
		orderBean = new OrderBean();
		orderBean.setType(2);
		orderBean.setValue("2012-12-23 下午2:23");
		msgList.add(orderBean);
		
		orderBean = new OrderBean();
		orderBean.setType(3);
		orderBean.setValue("99");
		msgList.add(orderBean);
		
		orderBean= new OrderBean();
		orderBean.setType(4);
		orderBean.setValue("99");
		msgList.add(orderBean);
		
		
		return msgList;
	}

}
